﻿package plugin.bagN
{
    import cmd.*;
    import com.core.*;
    import com.sh.game.display.*;
    import com.sh.game.global.*;
    import com.sh.game.util.*;
    import consts.*;
    import flash.display.*;
    import flash.events.*;
    import flash.geom.*;
    import flash.ui.*;
    import flash.utils.*;
    import manager.*;
    import morn.core.components.*;
    import morn.core.handlers.*;
    import plugin.storehouse.*;
    import uiresource.bag.*;
    import view.*;
    import view.appDrag.*;
    import view.effect.*;
    import view.uilt.*;
    import vo.*;

    public class BagitemCtrl extends bagitemUI
    {
        private var _timeID:uint = 0;
        private var opentime:int = 0;
        private var time:int = 0;
        private var arms:Object;
        private var _quad:Sprite;
        private var _bsquad:Sprite;
        private var _cfgtools:Object;
        private var _isDonw:Boolean = false;
        public var flashitem:BagFlashItem;
        private var mCDTime:Number = 0;
        private var _oneEffmc:XMLMovieClip;
        private var oneEffurl:String = "";
        public var superbox:Container;
        private var exp:int = 0;
        private var _timeID2:uint = 0;
        private var clicktime:int = 0;
        private var X:int;
        private var Y:int;
        private var _CDtime:uint = 0;
        private var lasttime:int;
        private var i:int;
        private var _data:Object;
        private var mStartCDTime:int = 0;
        private var mShowingCD:Boolean = false;
        private var mIntervalID:uint = 0;
        private var mWedgeSprite:Sprite;
        private var mMaskSprite:Sprite;
        public static var itemone1:Class = BagitemCtrl_itemone1;
        public static var itemEffDic:Object = {1:itemone1};
        private static var itemXMLDic:Object = new Object();

        public function BagitemCtrl()
        {
            return;
        }// end function

        override protected function initializeView() : void
        {
            super.initializeView();
            this.flashitem = new BagFlashItem();
            this.addChildAt(this.flashitem, 0);
            this._quad = new Sprite();
            this.addChild(this._quad);
            if (!this.mWedgeSprite)
            {
                this.mWedgeSprite = new Sprite();
                this.mWedgeSprite.x = 5;
                this.mWedgeSprite.y = 5;
                this.mWedgeSprite.mouseEnabled = false;
                addChildAt(this.mWedgeSprite, 2);
            }
            if (!this.mMaskSprite)
            {
                this.mMaskSprite = new Sprite();
                this.mMaskSprite.graphics.clear();
                this.mMaskSprite.graphics.beginFill(527368, 1);
                this.mMaskSprite.graphics.drawRect(5, 5, 38, 38);
                addChild(this.mMaskSprite);
                this.mWedgeSprite.mask = this.mMaskSprite;
            }
            this.superbox = new Container();
            this.superbox.y = 2;
            this.addChild(this.superbox);
            this.addEventListener(MouseEvent.CLICK, this.clickHandler);
            this.addEventListener(MouseEvent.MOUSE_DOWN, this.mouseDownHnalder);
            GlobalLayer.instance.flashStage.addEventListener(MouseEvent.MOUSE_UP, this.mouseUpHnalder);
            this.addEventListener(MouseEvent.MOUSE_MOVE, this.moveHandler);
            this.addEventListener(MouseEvent.ROLL_OVER, this.onOver);
            return;
        }// end function

        protected function onOver(event:MouseEvent) : void
        {
            var _loc_2:Point = null;
            var _loc_3:Object = null;
            var _loc_4:Object = null;
            var _loc_5:int = 0;
            if (this._data && this._data[4])
            {
                this.removeEventListener(MouseEvent.MOUSE_OVER, this.onOver);
                _loc_2 = new Point(GlobalLayer.instance.flashStage.mouseX, GlobalLayer.instance.flashStage.mouseY);
                if (this.data[2] == 1)
                {
                    _loc_3 = this.data[4];
                    _loc_3.wear = 0;
                    ModelProxy.change("tips", "arm", {data:_loc_3, p:_loc_2});
                }
                else if (this.data[2] == 2)
                {
                    _loc_4 = ItemObject.create(this.data[4]);
                    _loc_4.timeout = this.data[3];
                    ModelProxy.change("tips", "tool", {data:_loc_4, p:_loc_2});
                }
                this.addEventListener(MouseEvent.ROLL_OUT, this.onOut);
            }
            else if (this.data)
            {
                _loc_5 = UserData.getBagData("maxcount");
                if (this.data.lock == 1)
                {
                    if (this.data.index == (_loc_5 + 1))
                    {
                        ModelProxy.change("tips", "normal", "只要保持在线，背包就会自动开启点击可以加速开启\n" + "开启剩余时间：" + TimeDataFormatUtil.getLeftTimeStr(this.time - this.opentime) + "\n" + "开启时，可获取经验+" + this.exp);
                    }
                }
                this.addEventListener(MouseEvent.ROLL_OUT, this.onOut);
            }
            return;
        }// end function

        protected function onOut(event:MouseEvent) : void
        {
            this.removeEventListener(MouseEvent.MOUSE_OUT, this.onOut);
            ModelProxy.change("tips", "state", "close");
            this.addEventListener(MouseEvent.MOUSE_OVER, this.onOver);
            return;
        }// end function

        protected function moveHandler(event:MouseEvent) : void
        {
            var _loc_2:int = 0;
            var _loc_3:BitmapData = null;
            var _loc_4:Bitmap = null;
            if (this._isDonw)
            {
                this._isDonw = false;
                if (this.flashitem._iconBm == null || this.flashitem._iconBm.visible == false || this.data[4] == null || this.data.lock == 1)
                {
                    return;
                }
                _loc_2 = UserData.getBagData("ype");
                if (_loc_2 != 1 && _loc_2 != 0)
                {
                    return;
                }
                _loc_3 = new BitmapData(60, 60, true, 0);
                _loc_3.draw(this.flashitem._iconBm);
                _loc_4 = new Bitmap(_loc_3);
                _loc_4.scaleX = 0.6;
                _loc_4.scaleY = 0.6;
                AppDragMgr.clingyItem(this, this.data, _loc_4, 2, "bag");
                ModelProxy.change("bag", "closemenue", null);
            }
            return;
        }// end function

        protected function mouseUpHnalder(event:MouseEvent) : void
        {
            this._isDonw = false;
            AppDragMgr.cencelDrag();
            return;
        }// end function

        protected function mouseDownHnalder(event:MouseEvent) : void
        {
            this.downhandler();
            return;
        }// end function

        private function downhandler() : void
        {
            this._isDonw = true;
            return;
        }// end function

        protected function doubleClickHandler() : void
        {
            var _loc_2:Object = null;
            var _loc_3:Number = NaN;
            var _loc_4:int = 0;
            var _loc_5:int = 0;
            var _loc_6:int = 0;
            var _loc_7:Array = null;
            var _loc_8:Object = null;
            var _loc_9:String = null;
            var _loc_10:Array = null;
            var _loc_11:int = 0;
            var _loc_12:Number = NaN;
            var _loc_13:Number = NaN;
            var _loc_14:Number = NaN;
            var _loc_15:Point = null;
            var _loc_16:Array = null;
            var _loc_17:Array = null;
            var _loc_18:int = 0;
            var _loc_19:Object = null;
            var _loc_20:int = 0;
            var _loc_21:Object = null;
            var _loc_22:Object = null;
            var _loc_23:int = 0;
            if (DragImage.instance.funcDic["sell"])
            {
                return;
            }
            var _loc_1:* = new Object();
            if (this.data && ModelProxy.getValue("data", "business") != null)
            {
                _loc_1 = this.data;
                ModelProxy.change("business", "clientAddItem", _loc_1);
            }
            else if (this.data && PluginManager.instance.getPluginState("warehouse") == "open")
            {
                PluginManager.instance.sendToServer("warehouse", CMDStorehouse.Storage, this.data.index);
            }
            else if (this.data && this.data[2] == 2)
            {
                if (int(this.data[4].itemid) == 240202063)
                {
                    ModelProxy.change("movetips", "error", "未解封不能直接使用");
                    return;
                }
                if (int(this.data[4].itemid) == 207817)
                {
                    _loc_4 = GlobalLayer.instance.root.stageWidth / 2 - 320;
                    _loc_5 = GlobalLayer.instance.root.stageHeight / 2 - 320;
                    ModelProxy.change("mainui", "showOneParticle", {icon:"fireworks", xml:"fireworks", name:"fireworks", showPos:this.Vector.<int>([_loc_4, _loc_5, _loc_4 - 300, _loc_5 - 200, _loc_4 + 300, _loc_5 - 200, _loc_4 - 300, _loc_5 + 200, _loc_4 + 300, _loc_5 + 200, _loc_4 - 600, _loc_5, _loc_4 + 600, _loc_5]), timeInterval:this.Vector.<int>([200, 200, 0, 200, 200, 0, 200]), times:1, style:ZoneParticle.STYLE_HORIZONTAL, viewType:ZoneParticle.VIEW_RANDOM});
                }
                else if (int(this.data[4].itemid) == 207933)
                {
                    _loc_6 = ModelProxy.getValue("data", "acttype");
                    if (_loc_6 == 1)
                    {
                        ModelProxy.change("plugin", "open", {target:"doubleegg", data:7, point:UIGlobel.pointsDic["doubleegg"]});
                    }
                    else
                    {
                        ModelProxy.change("movetips", "error", "亲，不在活动时间内无法使用该道具！");
                    }
                    return;
                }
                else if (this.data[4].leixing == "珍宝")
                {
                    _loc_7 = (this.data[4].link as String).split("#");
                    ModelProxy.change("plugin", "open", {target:"shenzhuang", data:_loc_7[1]});
                    ModelProxy.change("shenzhuang", "szmsg", this.data);
                }
                else if (this.data[4].leixing == "强化卷")
                {
                    ModelProxy.change("plugin", "open", {target:"qhtips", data:this.data[4]});
                    return;
                }
                _loc_2 = ModelProxy.getValue("data", "toolcd");
                _loc_3 = _loc_2[this.data[4].itemid];
                if (getTimer() > _loc_3 || int(_loc_3) == 0)
                {
                    if (this._cfgtools == null)
                    {
                        this._cfgtools = ConfigDictionary.data.item;
                    }
                    _loc_8 = this._cfgtools[this.data[4].itemid];
                    if (this.data[4].link)
                    {
                        _loc_9 = this.data[4].link;
                        _loc_10 = _loc_9.split("#");
                        if (_loc_10[2])
                        {
                            if (this.data[4].leixing == "时装")
                            {
                                _loc_11 = UserData.getUserData("level");
                                if (_loc_11 < 80)
                                {
                                    WarningManager.show(30, [80, "时装系统"]);
                                    return;
                                }
                                _loc_12 = this.data[3];
                                _loc_13 = Number(ModelProxy.getValue("data", "servertime") + Number(getTimer()));
                                _loc_14 = _loc_12 - _loc_13;
                                if (this.data[3] > 0 && _loc_14 < 0)
                                {
                                    this.sureUseItem(this.data);
                                    return;
                                }
                                if (this.data[4].link == "role#5#0")
                                {
                                    ModelProxy.change("data", "hdZuoqiId", this._data[4].itemid);
                                }
                                _loc_15 = UIGlobel.pointsDic["role"];
                                _loc_16 = (this._data[4].link as String).split("#");
                                if (_loc_16[2])
                                {
                                    _loc_1.page = _loc_16[2];
                                }
                                PluginManager.instance.openPlugin("role", new Point(_loc_15.x, _loc_15.y), _loc_1);
                                this.sureUseItem(this.data);
                            }
                            else
                            {
                                this.openplugin(String(_loc_10[0]), {gototype:int(_loc_10[1]), newid:int(_loc_10[2])});
                            }
                            return;
                        }
                        if (_loc_10[1] && _loc_10[2] == null)
                        {
                            if (this.data[4].leixing == "灵石")
                            {
                                ModelProxy.change("bag", "closepanel", null);
                                _loc_17 = ConfigDictionary.data.gemlimit;
                                _loc_18 = UserData.getUserData("level");
                                _loc_19 = ConfigDictionary.data.openlevel;
                                _loc_20 = _loc_19["role"][4].level;
                                if (_loc_18 < _loc_20)
                                {
                                    WarningManager.show(30, [_loc_20, "灵石面板"]);
                                    return;
                                }
                            }
                            this.openplugin(String(_loc_10[0]), int(_loc_10[1]));
                            return;
                        }
                        ModelProxy.change("plugin", "useitem", this.data);
                    }
                    else
                    {
                        this.sureUseItem(this.data);
                    }
                }
            }
            else if (this.data && this.data[2] == 1)
            {
                _loc_21 = this.data[4];
                _loc_1.pos = 0;
                _loc_22 = ModelProxy.getValue("data", "arms");
                _loc_23 = _loc_21.cls;
                if (_loc_23 == 3 && _loc_22[_loc_23] != null)
                {
                    if (this.getPowValue(_loc_22[_loc_23]) > this.getPowValue(_loc_22[10]))
                    {
                        _loc_1.pos = 10;
                    }
                }
                else if (_loc_23 == 2 && _loc_22[_loc_23] != null)
                {
                    if (this.getPowValue(_loc_22[_loc_23]) > this.getPowValue(_loc_22[9]))
                    {
                        _loc_1.pos = 9;
                    }
                }
                _loc_1.armid = this.data[0];
                _loc_1.index = this.data.index;
                ModelProxy.change("bag", "putOn", _loc_1);
                ModelProxy.change("bag", "shangzhuangTX", new Point(this.X, this.Y));
            }
            return;
        }// end function

        private function openplugin(param1:String, param2:Object = null) : void
        {
            var _loc_4:int = 0;
            var _loc_3:* = UIGlobel.pointsDic[param1];
            if (param1 == "chuansong")
            {
                _loc_4 = int((GlobalLayer.instance.root.stageWidth - 700) / 2);
                ModelProxy.change("plugin", "change", {target:"npcdialog", point:new Point(GlobalLayer.instance.root.stageWidth / 2, GlobalLayer.instance.root.stageHeight / 2 - 120), top:new Point(_loc_4, 100), data:{npcid:218, type:"deliver", pay:1}});
                return;
            }
            if (_loc_3)
            {
                if (param2)
                {
                    PluginManager.instance.openPlugin(param1, new Point(_loc_3.x, _loc_3.y), param2);
                }
                else
                {
                    PluginManager.instance.openPlugin(param1, new Point(_loc_3.x, _loc_3.y));
                }
            }
            else if (param2)
            {
                PluginManager.instance.openPlugin(param1, new Point(100, 100), param2);
            }
            else
            {
                PluginManager.instance.openPlugin(param1, new Point(GlobalLayer.instance.root.stageWidth - 300, 100));
            }
            return;
        }// end function

        private function sureUseItem(param1:Object) : void
        {
            PluginManager.instance.playItemSound(param1[4]);
            if (int(param1[4].cls) == 4)
            {
                if (param1[4].buffertype == 100)
                {
                    ModelProxy.change("movetips", "error", "经验珠未满不能使用");
                    return;
                }
                DialogMgr.instance.open(AppDialog.JUHUNZHU, param1);
            }
            else if (int(param1[4].shuangji) == 1)
            {
                if (param1[4].buffertype == 8)
                {
                    if (ItemUilt.getVipLevelparam("eatexp") == -1 || ItemUilt.getVipLevelparam("eatexp") + Constant.EXP_PILL_DAILY_COUNT - (UserData.getOnlineData("EXP_PILL_EVERYDAY_USE_TIME") + UserData.getOnlineData("VIP_DAY_EXP_PILL_USE_COUNT")) > 0)
                    {
                        ModelProxy.change("data", "recycle", 1);
                    }
                }
                PluginManager.instance.sendToServer("bag", CMDBag.UseAllItem, param1.index);
                if (param1[4] && param1[4].buffertype == 8)
                {
                    if (ItemUilt.getVipLevelparam("eatexp") == -1 || ItemUilt.getVipLevelparam("eatexp") + Constant.EXP_PILL_DAILY_COUNT - (UserData.getOnlineData("EXP_PILL_EVERYDAY_USE_TIME") + UserData.getOnlineData("VIP_DAY_EXP_PILL_USE_COUNT")) > 0)
                    {
                        ModelProxy.change("data", "recycle", 1);
                    }
                }
            }
            else
            {
                ModelProxy.change("plugin", "useitem", param1);
            }
            ModelProxy.change("data", "changeid", param1[4].itemid);
            return;
        }// end function

        protected function clickHandler(event:MouseEvent) : void
        {
            var _loc_2:Object = null;
            var _loc_3:int = 0;
            event.stopPropagation();
            if (getTimer() - this.clicktime < 300)
            {
                this.clicktime = getTimer();
                this.X = event.stageX;
                this.Y = event.stageY;
                this.doubleClickHandler();
                ModelProxy.change("bag", "closemenue", null);
                return;
            }
            this.clicktime = getTimer();
            if (this.data)
            {
                ModelProxy.change("bag", "clickitem2", {data:this.data});
                if (this.data[0])
                {
                    _loc_2 = ModelProxy.getValue("key1", "keyDown1");
                    if (Mouse.cursor == "xiu")
                    {
                        if (this.data[2] == 1)
                        {
                            PluginManager.instance.sendToServer("shop", CMDShop.XiuOne, {aid:this.data[0], type:1});
                        }
                    }
                    else if (PluginManager.instance.getPluginState("stallage") == "open")
                    {
                        if (ModelProxy.getValue("data", "stallage") && ModelProxy.getValue("data", "stallage") == 2)
                        {
                            return;
                        }
                        if (ModelProxy.getValue("data", "stallage") && ModelProxy.getValue("data", "stallage") == 1)
                        {
                            ModelProxy.change("movetips", "error", "摆摊中");
                            return;
                        }
                        DialogMgr.instance.open(AppDialog.STALLAGE_POP, [this.data, this.data.index]);
                    }
                    else if (PluginManager.instance.getPluginState("warehouse") == "open")
                    {
                    }
                    else
                    {
                        if (_loc_2 && _loc_2.ctrlKey)
                        {
                            ModelProxy.change("chat", "additem", this.data);
                            return;
                        }
                        if (ModelProxy.getValue("data", "selling"))
                        {
                            ModelProxy.change("bag", "sellItem", this.data);
                        }
                    }
                }
                else if (this.data.lock == 1)
                {
                    _loc_3 = UserData.getBagData("maxcount");
                    DialogMgr.instance.open(AppDialog.OPEN_LOCK, this.data.index - _loc_3);
                }
                ModelProxy.change("bag", "closemenue", null);
            }
            return;
        }// end function

        public function get data() : Object
        {
            return this._data;
        }// end function

        private function clear() : void
        {
            _unlock.visible = false;
            _untime.visible = false;
            _upimg.visible = false;
            _uns.visible = false;
            szImg.visible = false;
            while (this.superbox.numChildren > 0)
            {
                
                this.superbox.removeChildAt(0);
            }
            if (this.mWedgeSprite)
            {
                this.mWedgeSprite.graphics.clear();
            }
            if (GlobalLayer.instance.root && GlobalLayer.instance.root.hasEventListener(Event.ENTER_FRAME))
            {
                GlobalLayer.instance.root.removeEventListener(Event.ENTER_FRAME, this.onEnterFrame);
            }
            return;
        }// end function

        public function drawBusLock() : void
        {
            if (this._bsquad == null)
            {
                this._bsquad = new Sprite();
                this.addChild(this._bsquad);
            }
            this._bsquad.graphics.clear();
            this._bsquad.graphics.beginFill(MColor.New27, 0.5);
            this._bsquad.graphics.drawRect(6, 6, 38, 38);
            this._bsquad.graphics.endFill();
            this._bsquad.visible = true;
            return;
        }// end function

        public function clearBusLock() : void
        {
            if (this._bsquad)
            {
                this.removeChild(this._bsquad);
                this._bsquad.graphics.clear();
                this._bsquad = null;
            }
            return;
        }// end function

        public function set data(param1:Object) : void
        {
            var _loc_2:Object = null;
            var _loc_3:Object = null;
            var _loc_4:int = 0;
            var _loc_5:int = 0;
            var _loc_6:Number = NaN;
            var _loc_7:int = 0;
            var _loc_8:int = 0;
            var _loc_9:Object = null;
            var _loc_10:int = 0;
            var _loc_11:Object = null;
            var _loc_12:int = 0;
            this._data = param1;
            this.oneEffurl = "";
            this.arms = ModelProxy.getValue("data", "arms");
            auto.visible = false;
            this.exp = 0;
            if (this._timeID > 0)
            {
                clearInterval(this._timeID);
                this._timeID = 0;
            }
            this.time = 0;
            this.opentime = 0;
            this.clear();
            this._quad.visible = false;
            auto.visible = false;
            count.text = "";
            this.flashitem.disposeEffect();
            if (this.data.index == (_loc_2.maxcount + 1))
            {
                if (_loc_3.privilegeCardLevel > 0)
                {
                    switch(_loc_3.privilegeCardLevel)
                    {
                        case 1:
                        {
                            break;
                        }
                        case 2:
                        {
                            break;
                        }
                        case 3:
                        {
                            break;
                        }
                        default:
                        {
                            break;
                        }
                    }
                }
                if (this.mIntervalID > 0)
                {
                }
            }
            if (this.data[1] > 1)
            {
            }
            else
            {
            }
            if (this.data[0] && this.data[4])
            {
                if (this.data[4].itemtype == 1)
                {
                    if (this.data[4].superlevel > 0)
                    {
                    }
                }
                if (this.data[4].itemtype == 1)
                {
                    if (this.data[4].suitid > 0)
                    {
                        if (this.data[4].suitid < 100)
                        {
                        }
                        else
                        {
                        }
                    }
                    if (this.data[4].career > 0 && UserData.getUserData("career") != this.data[4].career)
                    {
                    }
                    else if (this.data[4].sex < 2 && UserData.getUserData("sex") != this.data[4].sex)
                    {
                    }
                    else
                    {
                    }
                    if (_loc_8 == 3 && this.arms[_loc_8] != null)
                    {
                        if (this.getPowValue(this.arms[_loc_8]) > this.getPowValue(this.arms[10]))
                        {
                        }
                    }
                    else if (_loc_8 == 2 && this.arms[_loc_8] != null)
                    {
                        if (this.getPowValue(this.arms[_loc_8]) > this.getPowValue(this.arms[9]))
                        {
                        }
                    }
                    if (_loc_9)
                    {
                        if (_loc_10 > _loc_12)
                        {
                        }
                        else if (_loc_10 == _loc_12)
                        {
                        }
                        else
                        {
                        }
                    }
                    else
                    {
                    }
                }
                else
                {
                }
                if (_uns.visible)
                {
                }
                else
                {
                }
            }
            else
            {
            }
            if (this.data[4] && this.data.showcd == 1)
            {
                this.startCd();
                this.data.showcd = 0;
            }
            if (this._data.param > 0)
            {
                if (this._oneEffmc == null)
                {
                    this.oneEffurl = "assets/images/bag/itemone" + param1.param + ".swf";
                    if (App.asset.getClass("itemone" + param1.param))
                    {
                        this.onCompitemeffect(param1.param, null);
                    }
                    else
                    {
                        App.mloader3.loadSWF(Config.getUrl(this.oneEffurl), 1, new Handler(this.onCompitemeffect, [param1.param]));
                    }
                }
                else
                {
                    this.oneEffurl = "assets/images/bag/itemone" + param1.param + ".swf";
                    this.addChild(this._oneEffmc);
                    this._oneEffmc.playFromTo(Math.random() * 3, (this._oneEffmc.totalFrame - 1), new Handler(this.removeOneEff));
                }
            }
            if (this._data.isbusiness)
            {
                this.drawBusLock();
            }
            else
            {
                this.clearBusLock();
            }
            this._data.param = 0;
            return;
        }// end function

        private function addStartImg(param1:int) : void
        {
            while (this.superbox.numChildren > 0)
            {
                
                this.superbox.removeChildAt(0);
            }
            this.superbox.x = 5;
            var _loc_2:* = new Label();
            _loc_2.color = MColor.New62;
            _loc_2.height = 22;
            _loc_2.width = 40;
            _loc_2.font = "Simsun";
            _loc_2.align = "right";
            _loc_2.stroke = "0x0";
            _loc_2.bold = true;
            _loc_2.size = 12;
            _loc_2.text = "+" + param1;
            this.superbox.addChild(_loc_2);
            return;
        }// end function

        private function onCompitemeffect(param1:int, param2:Object) : void
        {
            if (this.oneEffurl == "")
            {
                return;
            }
            if (itemXMLDic[param1] == null)
            {
                itemXMLDic[param1] = new XML(new itemEffDic[param1]);
            }
            this._oneEffmc = new XMLMovieClip("itemone" + param1, itemXMLDic[param1]);
            this._oneEffmc.interval = 1000 / 12;
            this._oneEffmc.x = -126;
            this._oneEffmc.y = -126;
            this._oneEffmc.blendMode = BlendMode.ADD;
            this._oneEffmc.playFromTo(Math.random() * 3, (this._oneEffmc.totalFrame - 1), new Handler(this.removeOneEff));
            this._oneEffmc.mouseChildren = false;
            this._oneEffmc.mouseEnabled = false;
            this.addChild(this._oneEffmc);
            return;
        }// end function

        private function removeOneEff() : void
        {
            if (this._oneEffmc && this._oneEffmc.parent)
            {
                this._oneEffmc.stop();
                this._oneEffmc.parent.removeChild(this._oneEffmc);
            }
            return;
        }// end function

        public function startCd(param1:int = 0) : void
        {
            if (this.data == null)
            {
                return;
            }
            this.mCDTime = this.data[4].usecd;
            this.mShowingCD = true;
            if (param1 == 0)
            {
                this.mStartCDTime = getTimer();
            }
            if (this.mIntervalID > 0)
            {
                clearInterval(this.mIntervalID);
                this.mIntervalID = 0;
            }
            this.mIntervalID = setInterval(this.cdProgress1, 1000 / 30);
            return;
        }// end function

        private function cdProgress1() : void
        {
            var _loc_1:* = getTimer();
            var _loc_2:* = 360 * (_loc_1 - this.mStartCDTime) / (this.mCDTime * 1000);
            if (_loc_2 >= 360)
            {
                this.mWedgeSprite.graphics.clear();
                this.stopCD();
                return;
            }
            this.mWedgeSprite.graphics.clear();
            this.mWedgeSprite.graphics.lineStyle(0, 0, 0);
            this.mWedgeSprite.graphics.beginFill(0, 0.8);
            DrawUtils.wedge(this.mWedgeSprite, 38 / 2, 38 / 2, 90, 360 - _loc_2, 38, 38);
            return;
        }// end function

        private function cdProgress() : void
        {
            var _loc_1:* = 360 * (this.mCDTime - this.opentime) / this.mCDTime;
            if (_loc_1 >= 360 || this.mWedgeSprite == null)
            {
                this.mWedgeSprite.graphics.clear();
                if (this.mIntervalID > 0)
                {
                    clearInterval(this.mIntervalID);
                    this.mIntervalID = 0;
                }
                return;
            }
            this.mWedgeSprite.graphics.clear();
            this.mWedgeSprite.graphics.lineStyle(0, 0, 0);
            this.mWedgeSprite.graphics.beginFill(0, 0.8);
            DrawUtils.wedge(this.mWedgeSprite, 38 / 2, 38 / 2, 90, _loc_1, 38, 38);
            var _loc_2:String = this;
            var _loc_3:* = this.opentime + 1;
            _loc_2.opentime = _loc_3;
            return;
        }// end function

        public function stopCD() : void
        {
            if (this.mIntervalID > 0)
            {
                clearInterval(this.mIntervalID);
                this.mIntervalID = 0;
            }
            this.mShowingCD = false;
            this.mCDTime = 0;
            return;
        }// end function

        private function onEnterFrame(event:Event) : void
        {
            var _loc_2:* = new Date().getTime();
            if (this.lasttime == 0)
            {
                this.lasttime = _loc_2;
            }
            if (int(this._quad.y) == 38)
            {
                GlobalLayer.instance.root.removeEventListener(Event.ENTER_FRAME, this.onEnterFrame);
                this._quad.visible = false;
                return;
            }
            var _loc_3:* = _loc_2 - this.lasttime;
            this._quad.y = this._quad.y + 38 / this.i * _loc_3 / 1000;
            this._quad.height = this._quad.height - 38 / this.i * _loc_3 / 1000;
            this.lasttime = _loc_2;
            return;
        }// end function

        private function showopen() : void
        {
            var _loc_1:String = this;
            var _loc_2:* = this.opentime + 1;
            _loc_1.opentime = _loc_2;
            this._quad.y = 38 * this.opentime / this.time;
            this._quad.height = 38 * (this.time - this.opentime) / this.time;
            return;
        }// end function

        private function getPowValue(param1:Object) : int
        {
            if (param1 == null || !param1.hasOwnProperty("itemid"))
            {
                return 0;
            }
            return param1.nbvalue;
        }// end function

    }
}
